[ty] Fix subtyping of type[Any] / type[T] and protocols#21678
Merged
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
sharkdp
commented
Nov 28, 2025
Comment on lines
+47
to
+49
| # TODO: no errors here | ||
| # error: [invalid-type-arguments] "Type `typing.TypeVar` is not assignable to upper bound `generic[Any]` of type variable `_ScalarT_co@dtype`" | ||
| # error: [invalid-type-arguments] "Type `typing.TypeVar` is not assignable to upper bound `generic[Any]` of type variable `_ScalarT_co@dtype`" |
Contributor
Author
There was a problem hiding this comment.
These errors prevent us from running into the problem on main. But on #21553, these errors will go away, and then we need to properly understand all of this code here, or otherwise we see np.array calls failing all over the place.
AlexWaygood
approved these changes
Nov 28, 2025
Member
AlexWaygood
left a comment
There was a problem hiding this comment.
Some suggestions, but they're untested, so accept them with care 😄
7cadc6f to
80bc86e
Compare
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
0 | 28 | 4 |
no-matching-overload |
0 | 11 | 0 |
invalid-assignment |
0 | 0 | 3 |
invalid-parameter-default |
0 | 3 | 0 |
unused-ignore-comment |
2 | 0 | 0 |
| Total | 2 | 42 | 7 |
AlexWaygood
reviewed
Nov 28, 2025
80bc86e to
2be7bbe
Compare
dtypetype[Any] / type[T] and protocols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a bugfix for subtyping of
type[Any]/type[T]and protocols.Test Plan
Regression test that will only be really meaningful once #21553 lands.